package de.homer.persistence;

import java.io.Serializable;
import java.util.Collection;

/**
 * An Interface defining the operations needed in a repository for entity of
 * type T.
 * 
 * @author André Stannek
 * @param <T>
 *            the type of entity that is managed by the repository
 * 
 */
public interface Repository<T> extends Serializable {

	/**
	 * Updates the data of an existing entity or creates it if it doesn't exits.
	 * 
	 * @param entity
	 *            the entity to update
	 */
	void merge(T entity);

	/**
	 * Removes an entity from the repository.
	 * 
	 * @param entity
	 *            teh entity to remove
	 */
	void remove(T entity);

	/**
	 * @return all entities known in the system
	 */
	Collection<T> getAll();
}
